home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14531 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  60 lines

  1. Path: interramp.com!usenet
  2. From: us017159@interramp.com (Tom Schecker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: CGI application
  5. Date: Sat, 30 Mar 1996 22:57:08 GMT
  6. Organization: PSI Public Usenet Link
  7. Message-ID: <4jke6r$79o@usenet7.interramp.com>
  8. References: <3156BE73.2F6B@lia.infolink.co.za>
  9. NNTP-Posting-Host: ip191.newark.nj.interramp.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Louis Viljoen <lviljoen@lia.infolink.co.za> wrote:
  13.  
  14. >I would like to know more about cgi applications. I am trying to write 
  15. >some basic applications using BC4.53. In my cgi-application I used the 
  16. >printf() or fprinf(stdout,) functions to write to the standard output 
  17. >steam. If I execute the cgi-application from within my homepage I don't 
  18. >get the output at the client-side, but if I execute the cgi-application 
  19. >directly the output is generated at the client as intended.
  20. >What do I need to do to get the output when executing from my page.
  21.  
  22. >Louis Viljoen
  23.  
  24. I am extremely new to this area, but I happened to try this same thing
  25. just yesterday.  Using VC++4.0, the following created a HTML file
  26. displaying a list of the Environment variables:
  27.  
  28. #include <iostream.h>
  29. #include <string.h>
  30.  
  31. void main( int argc, char *argv[], char *envp[] )
  32. {
  33.     int iNumberLines = 0;    // Default is no line numbers.
  34.     cout << "Content-type: text/html\n\n";
  35.     cout << "";
  36.     cout << "<HTML>\n";
  37.     cout << "<HEAD>\n";
  38.     cout << "<TITLE>title here</TITLE>\n";
  39.     cout << "</HEAD>\n";
  40.     cout << "<BODY>\n";
  41.     cout << "<P>This is the stuff from C++ as modified.\n";
  42.     for( int i = 0; envp[i] != NULL; ++i )
  43.     {
  44. //        if( iNumberLines )
  45.             cout << "<P>" << i << ": " << envp[i] << "\n";
  46.     }
  47.     cout << "</BODY>\n";
  48.     cout << "</HTML>\n";
  49. }
  50.  
  51. You might also be interested to know of a web site I found yesterday
  52. that offers cgi Class (object, not education) to help parse the
  53. variables.  It's at :
  54. http://sweetbay.will.uiuc.edu/cgi%2b%2b/
  55.  
  56. Hope this helps.
  57.  
  58. Tom Schecker
  59.  
  60.